#ifndef AESTOOLS_H
#define AESTOOLS_H
#include <QByteArray>

#include "Rijndael.h"

/**
 *该类实现加密解密
 *
 *  QString key = "1234567812345678";
    AESTools *aes = new AESTools(&key);
    QString mw = "test";
    QString b64 = aes->Encrypt(&mw);

    //打印信息
    qDebug() << "mingwen:" << b64;
    qDebug() << "jiemi:" << aes->Decrypt(&b64);

 */
class AESTools
{
private:
    CRijndael crijndael;
public:
    /**
     * @brief AESTools
     * @param key
     * 如果密匙长度不是16，自动纠正
     */
    AESTools(QString *key);

    static QByteArray baseEncry(const QString &q);
    static QByteArray fourExchange(QByteArray &byte);
    static QByteArray baseDecry(QByteArray &byte);
};

#endif // AESTOOLS_H
